package com.maple.soa.util;

import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * @author lijian
 * @date 2020/5/27
 */
public class Md5Utils {

    public static String encryptMd5(String data) {
        MessageDigest jdkMd5 = null;
        try {
            jdkMd5 = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return Hex.encodeHexString(jdkMd5.digest(data.getBytes()));
    }

}
